package base.io;

import java.io.*;

// 按照 多个字符 进行读取
public class ReaderAndWriterTest002 {
  
  public static final String COMMON_PATH = "E:%stest%s";
  
  public static void main(String[] args) throws IOException {
    String filePath = String.format(COMMON_PATH + "1.input.md", File.separator, File.separator);
    
    // 要每次获取多个元素。这里是每次读取多个字符
    char[] chars = new char[4];
    FileReader fileReader = new FileReader(filePath);
    
    int readLength;
    while ((readLength = fileReader.read(chars)) != -1) {
      System.out.println(String.valueOf(chars, 0, readLength));
    }
    
    fileReader.close();
  }
}
